﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:common="clr-namespace:Brjnk.Common;assembly=Common"
                    xmlns:controls="clr-namespace:Brjnk.GpxExplorer.UI.Controls;assembly=GpxExplorer"
                    xmlns:data="clr-namespace:Brjnk.GpxExplorer.Data;assembly=GpxExplorer"
                    xmlns:l="clr-namespace:Brjnk.GpxExplorer.Localization;assembly=GpxExplorer"
                    xmlns:layers="clr-namespace:Brjnk.CoordinateSystem2D.Layers;assembly=CoordinateSystem2D"
                    xmlns:loc="clr-namespace:Brjnk.GpxExplorer.Localization;assembly=GpxExplorer"
                    xmlns:local="clr-namespace:Brjnk.GpxExplorer;assembly=GpxExplorer"
                    xmlns:ui="clr-namespace:Brjnk.Common.UI;assembly=Common"
                    xmlns:vm="clr-namespace:Brjnk.GpxExplorer.ViewModel;assembly=GpxExplorer"
                    xmlns:workspace="clr-namespace:Brjnk.GpxExplorer.Workspace;assembly=GpxExplorer"
                    xmlns:searching="clr-namespace:Brjnk.GpxExplorer.Workspace.Searching">
    <DataTemplate x:Key="WaypointItemTemplate">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="48" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <!--  Checkbox s upravenou control template, která IsChecked state zobrazuje prostřednictvím 2 ikon  -->
            <CheckBox Grid.RowSpan="2" IsChecked="{Binding Path=IsVisible}">
                <CheckBox.Template>
                    <ControlTemplate>
                        <ControlTemplate.Triggers>
                            <Trigger Property="CheckBox.IsChecked" Value="True">
                                <Setter TargetName="icon" Property="Image.Visibility" Value="Visible" />
                                <Setter TargetName="iconGray" Property="Image.Visibility" Value="Collapsed" />
                            </Trigger>
                            <Trigger Property="CheckBox.IsChecked" Value="False">
                                <Setter TargetName="icon" Property="Image.Visibility" Value="Collapsed" />
                                <Setter TargetName="iconGray" Property="Image.Visibility" Value="Visible" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Image Name="icon"
                                   Width="32"
                                   Height="32"
                                   Source="/Resources/Icons/Waypoint.png" />
                            <Image Name="iconGray"
                                   Width="32"
                                   Height="32"
                                   Source="/Resources/Icons/WaypointG.png" />
                        </Grid>
                    </ControlTemplate>
                </CheckBox.Template>
            </CheckBox>
            <TextBlock Grid.Column="1"
                       FontWeight="Bold"
                       Text="{Binding Path=Source.Name}" />
            <TextBlock Grid.Row="1"
                       Grid.Column="1"
                       Text="{Binding Path=Source.Position}" />
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="RouteItemTemplate">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="48" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <CheckBox Grid.RowSpan="2" IsChecked="{Binding Path=IsVisible}">
                <CheckBox.Template>
                    <ControlTemplate>
                        <ControlTemplate.Triggers>
                            <Trigger Property="CheckBox.IsChecked" Value="True">
                                <Setter TargetName="icon" Property="Image.Visibility" Value="Visible" />
                                <Setter TargetName="iconGray" Property="Image.Visibility" Value="Collapsed" />
                            </Trigger>
                            <Trigger Property="CheckBox.IsChecked" Value="False">
                                <Setter TargetName="icon" Property="Image.Visibility" Value="Collapsed" />
                                <Setter TargetName="iconGray" Property="Image.Visibility" Value="Visible" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Image Name="icon"
                                   Width="32"
                                   Height="32"
                                   Source="/Resources/Icons/Route.png" />
                            <Image Name="iconGray"
                                   Width="32"
                                   Height="32"
                                   Source="/Resources/Icons/RouteG.png" />
                        </Grid>
                    </ControlTemplate>
                </CheckBox.Template>
            </CheckBox>
            <TextBlock Grid.Column="1"
                       FontWeight="Bold"
                       Text="{Binding Path=Source.Name}" />
            <TextBlock Grid.Row="1"
                       Grid.Column="1"
                       Text="{Binding Path=Distance}" />
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="TrackItemTemplate">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="48" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <CheckBox Grid.RowSpan="2" IsChecked="{Binding Path=IsVisible}">
                <CheckBox.Template>
                    <ControlTemplate>
                        <ControlTemplate.Triggers>
                            <Trigger Property="CheckBox.IsChecked" Value="True">
                                <Setter TargetName="icon" Property="Image.Visibility" Value="Visible" />
                                <Setter TargetName="iconGray" Property="Image.Visibility" Value="Collapsed" />
                            </Trigger>
                            <Trigger Property="CheckBox.IsChecked" Value="False">
                                <Setter TargetName="icon" Property="Image.Visibility" Value="Collapsed" />
                                <Setter TargetName="iconGray" Property="Image.Visibility" Value="Visible" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Image Name="icon"
                                   Width="32"
                                   Height="32"
                                   Source="/Resources/Icons/Track.png" />
                            <Image Name="iconGray"
                                   Width="32"
                                   Height="32"
                                   Source="/Resources/Icons/TrackG.png" />
                        </Grid>
                    </ControlTemplate>
                </CheckBox.Template>
            </CheckBox>
            <TextBlock Grid.Column="1"
                       FontWeight="Bold"
                       Text="{Binding Path=Source.Name}" />
            <TextBlock Grid.Row="1"
                       Grid.Column="1"
                       Text="{Binding Path=Distance}" />
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="RouteImportTemplate" DataType="data:Route">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Text="{Binding Source.Name}" />
            <TextBlock Grid.Row="1"
                       FontSize="10"
                       Text="{Binding Distance}" />
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="WaypointImportTemplate" DataType="data:Waypoint">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Text="{Binding Source.Name}" />
            <TextBlock Grid.Row="1"
                       FontSize="10"
                       Text="{Binding Source.Position}" />
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="TrackImportTemplate" DataType="data:Track">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Text="{Binding Source.Name}" />
            <TextBlock Grid.Row="1"
                       FontSize="10"
                       Text="{Binding Distance}" />
        </Grid>
    </DataTemplate>
</ResourceDictionary>